<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>易买网 - 首页</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="scripts/function.js"></script>
<script type="text/javascript">
	function Test(){
		if(loginFom.userName.value==""){
			alert("请输入用户名！！！");
			loginFom.userName.focus();
			return;
		}
		if(loginFom.passWord.value==""){
			alert("请输入用户密码！！！");
			logFom.passWord.focus();
			return;
		}
		if(loginFom.veryCode.value==""){
			var veryCode = document.getElementById("veryCode").value;
			alert("请输入验证码！！！");
			logFom.veryCode.focus();
			return;
		}
		loginFom.submit();
	}
</script>
</head>
<%
//第二次客户到超市，拿出会员卡
	String name="";
	//读取Cookie 服务器端在读
	Cookie[] cookise = request.getCookies();
	if(cookise!=null){ //如果客户端没有Cookie，做判断免得程序出现空指针异常
		for(int i=0;i<cookise.length;i++){
			//System.out.println(cookies[i].getName());
			//System.out.println(cookies[i].getValue());
			if(cookise[i].getName().equals("name")){ //匹配键名
				name=cookise[i].getValue();
			}
		}
	}
//	System.out.print(name);
 %>
<body>
<div id="header" class="wrap">
	<div id="logo"><img src="images/logo.gif" /></div>
	<div class="help"><a href="#" class="shopping">购物车</a><a href="login.jsp">登录</a>
	<a href="#" onclick="Tz()">注册</a><a href="guestbook.html">留言</a></div>
	<script type="text/javascript">
		function Tz(){
			alert("正在跳转到注册页面………………");
			window.location.href="register.jsp";
		}
	</script>
	<div class="navbar">
		<ul class="clearfix">
			<li class="current"><a href="#">首页</a></li>
			<li><a href="#">图书</a></li>
			<li><a href="#">百货</a></li>
			<li><a href="#">品牌</a></li>
			<li><a href="#">促销</a></li>
		</ul>
	</div>
</div>
<div id="childNav">
	<div class="wrap">
		<ul class="clearfix">
			<li class="first"><a href="#">音乐</a></li>
			<li><a href="#">影视</a></li>
			<li><a href="#">少儿</a></li>
			<li><a href="#">动漫</a></li>
			<li><a href="#">小说</a></li>
			<li><a href="#">外语</a></li>
			<li><a href="#">数码相机</a></li>
			<li><a href="#">笔记本</a></li>
			<li><a href="#">羽绒服</a></li>
			<li><a href="#">秋冬靴</a></li>
			<li><a href="#">运动鞋</a></li>
			<li><a href="#">美容护肤</a></li>
			<li><a href="#">家纺用品</a></li>
			<li><a href="#">婴幼奶粉</a></li>
			<li><a href="#">饰品</a></li>
			<li class="last"><a href="#">Investor Relations</a></li>
		</ul>
	</div>
</div>
<div id="register" class="wrap">
	<div class="shadow">
		<em class="corner lb"></em>
		<em class="corner rt"></em>
		<div class="box">
			<h1>欢迎回到易买网</h1>
			<form id="loginForm" name="loginFom" method="post" action="LoginServlet" onsubmit="return checkForm(this)">
				<table>
					<tr>
						<td class="field">用户名：</td>
						<td><input class="text" type="text" name="userName" onfocus="FocusItem(this)" onblur="CheckItem(this);"  value="<%=name%>"/><span></span></td>
					</tr>
					<tr>
						<td class="field">登录密码：</td>
						<td><input class="text" type="password" id="passWord" name="passWord" onfocus="FocusItem(this)" onblur="CheckItem(this);"/><span></span></td>
					</tr>
					<tr>
						<td class="field">验证码：</td>
						<td><input class="text verycode" type="text" name="veryCode" onfocus="FocusItem(this)" onblur="CheckItem(this);" /><img id="veryCode" src="RandomPicture" /><span></span></td>
					</tr>

					</tr>
					<tr>
						<td class="field"><input type="checkbox" name="cookise" value="jz"/></td>
						<td>记住用户</td>
					</tr>
					<tr>
						<td></td>
						<td><label class="ui-green"><input type="button" name="Submit" value="立即登录" onclick="Test()"/></label></td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div id="footer">
	Copyright &copy; 2010 湖南汽车工程职业学院 All Rights Reserved. 京ICP证1000001号
</div>

</body>
</html>
